package com.agile4j.oss.adapter;

import org.springframework.http.ResponseEntity;
import org.springframework.web.multipart.MultipartFile;

import java.io.FileInputStream;
import java.io.InputStream;
import java.util.List;
import java.util.Map;

// OssClientAdapter.java

/**
 * @author cthd
 * {@code @date}  2025/9/17 16:04
 * @version 1.0
 * Description: OssClientAdapter.class
 */
public interface OssClientAdapter {

    void existBucket(String name) throws Exception;

    Boolean makeBucket(String bucketName);

    Boolean removeBucket(String bucketName);

    String download(String url, String path);

    InputStream download(String url);

    byte[] downloadByte(String url);

    ResponseEntity<byte[]> downloadByUrl(String url);

    Iterable<Result<DeleteError>> removeObjects(String bucketName, List<String> objects);

    String delete(String module, String fileName);

    Boolean checkFileIsExist(String bucketName, String objectName);

    Map<String, Object> copyObject(String sourcePath, String copyPath) throws RuntimeException;

    Map<String, Object> upload(MultipartFile multipartFile, String path);

    Map<String, Object> upload(FileInputStream inputStream, String path, String fileName);

    List<Map<String, Object>> listObjects(String bucketName);

    Map<String,Object> uploadRel(MultipartFile multipartFile, String path);

    String getPreviewUrl(String pathUrl);

    /**
     *
     * @param bucketName
     * @return
     */
    List<String> getBucketObjects (String bucketName);

    /**
     *
     * @param module
     * @param fileName
     */
    void removeObject(String module, String fileName);

    void createBucket(String bucketName);

    void putObject(String module, String path, String filePath);
}